package com.mywork.mvpkodeinxml.net.api

import com.mywork.mvpkodeinxml.model.response.BaseEntity
import io.reactivex.Observable
import okhttp3.RequestBody
import retrofit2.http.*

/**
 * Created by mywork on 17/3/16.
 */

interface UploadApi {
    @Headers("Connection: Keep-Alive", "Charset: UTF-8", "Content-Type: multipart/form-data;boundary=*****")
    @POST("/KrsIPUI/T95Service/EmFileHandler.ashx?optag=1")
    fun upload(
        @Query("userCode") userCode: String,
        @Query("userPassword") userPassword: String,
        @Query("formtype") formtype: String,
        @Query("taskid") taskid: String,
        @Query("filename") filename: String,
        @Body img: RequestBody
    ): Observable<BaseEntity>

    //服务器不支持Multipart方式上传
    @Headers("Connection: Keep-Alive", "Charset: UTF-8", "Content-Type: multipart/form-data;boundary=*****")
    @POST("/KrsIPUI/T95Service/EmFileHandler.ashx?optag=1")
    @Multipart
    fun uploadMultipart(
        @Query("userCode") userCode: String,
        @Query("userPassword") userPassword: String,
        @Query("formtype") formtype: String,
        @Query("taskid") taskid: String,
        @Query("filename") filename: String,
        @PartMap paramMap: MutableMap<String, RequestBody>
    ): Observable<BaseEntity>
}
